mirror of
https://github.com/vacp2p/status-linea-besu.git
synced 2026-01-08 21:38:15 -05:00
EIP-7702: devnet-4 changes (#7809)
* warm up to address at tx start if account is delegated, restrict auth nonce to 2**64-1 Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * rename requestsRoot to requestsHash Signed-off-by: Jason Frame <jason.frame@consensys.net> * return no code if account has delegated code to precompile, treat precompile always as warm account when resolving code Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * make accessListWarmAddresses generic again Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * warm delegatee account if transaction destination has delegated code Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * * verify auth nonce less than 2**64-1 during auth processing * auth to zero address deletes delegation * auth to precompile returns empty code * auth nonce < 2**8 * increase auth base cost to 12500 Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * generalised requests flat encoding and engine api changes Signed-off-by: Jason Frame <jason.frame@consensys.net> * javadoc Signed-off-by: Jason Frame <jason.frame@consensys.net> * get tests passing Signed-off-by: Jason Frame <jason.frame@consensys.net> * get tests passing Signed-off-by: Jason Frame <jason.frame@consensys.net> * clean code Signed-off-by: Jason Frame <jason.frame@consensys.net> * change requests to single requestData for each requestType Signed-off-by: Jason Frame <jason.frame@consensys.net> * fix PoWBlockCreatorTest after requests data type change Signed-off-by: Jason Frame <jason.frame@consensys.net> * don't return request type in getPayload result Signed-off-by: Jason Frame <jason.frame@consensys.net> don't return request type in getPayload result Signed-off-by: Jason Frame <jason.frame@consensys.net> * include requests in t8n response Signed-off-by: Jason Frame <jason.frame@consensys.net> * update contract addresses for consolidation requests and withdrawal requests Signed-off-by: Jason Frame <jason.frame@consensys.net> * fix requestHash calculation Signed-off-by: Jason Frame <jason.frame@consensys.net> * Ensure that execution requests always return a response Signed-off-by: Jason Frame <jason.frame@consensys.net> * added and fixed bound checks, fixed some compilation errors after the rebase Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * revert changes to evm tool spec tests Signed-off-by: Jason Frame <jason.frame@consensys.net> * clean up Signed-off-by: Jason Frame <jason.frame@consensys.net> * replace AbstractSystemCallRequestProcessor to concrete class and remove specific processors Signed-off-by: Jason Frame <jason.frame@consensys.net> * spotless Signed-off-by: Jason Frame <jason.frame@consensys.net> * update evmtool tests for 7685 changes Signed-off-by: Jason Frame <jason.frame@consensys.net> * use empty requests hash prague fork at genesis Signed-off-by: Jason Frame <jason.frame@consensys.net> * review suggestions Signed-off-by: Jason Frame <jason.frame@consensys.net> * temporarily comment out osakaTime from Prague Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * engine API validation Signed-off-by: Jason Frame <jason.frame@consensys.net> * update plugin API hash Signed-off-by: Jason Frame <jason.frame@consensys.net> * fix GenesisStateTest Signed-off-by: Jason Frame <jason.frame@consensys.net> * comment out unused evmWorldUpdater.parentUpdater() check Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * added CodeDelegationProcessorTest Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * code clean up Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> * spotless Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> --------- Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net> Signed-off-by: Jason Frame <jason.frame@consensys.net> Co-authored-by: Jason Frame <jason.frame@consensys.net>
This commit is contained in:
@@ -214,7 +214,7 @@ public abstract class AbstractSECP256 implements SignatureAlgorithm {
|
||||
|
||||
@Override
|
||||
public CodeDelegationSignature createCodeDelegationSignature(
|
||||
final BigInteger r, final BigInteger s, final BigInteger yParity) {
|
||||
final BigInteger r, final BigInteger s, final byte yParity) {
|
||||
return CodeDelegationSignature.create(r, s, yParity);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CodeDelegationSignature extends SECPSignature {
|
||||
* @return the new CodeDelegationSignature
|
||||
*/
|
||||
public static CodeDelegationSignature create(
|
||||
final BigInteger r, final BigInteger s, final BigInteger yParity) {
|
||||
final BigInteger r, final BigInteger s, final byte yParity) {
|
||||
checkNotNull(r);
|
||||
checkNotNull(s);
|
||||
|
||||
@@ -56,11 +56,6 @@ public class CodeDelegationSignature extends SECPSignature {
|
||||
"Invalid 's' value, should be < 2^256 but got " + s.toString(16));
|
||||
}
|
||||
|
||||
if (yParity.compareTo(TWO_POW_256) >= 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid 'yParity' value, should be < 2^256 but got " + yParity.toString(16));
|
||||
}
|
||||
|
||||
return new CodeDelegationSignature(r, s, yParity.byteValue());
|
||||
return new CodeDelegationSignature(r, s, yParity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ public interface SignatureAlgorithm {
|
||||
* @return the code delegation signature
|
||||
*/
|
||||
CodeDelegationSignature createCodeDelegationSignature(
|
||||
final BigInteger r, final BigInteger s, final BigInteger yParity);
|
||||
final BigInteger r, final BigInteger s, final byte yParity);
|
||||
|
||||
/**
|
||||
* Decode secp signature.
|
||||
|
||||
@@ -29,19 +29,19 @@ class CodeDelegationSignatureTest {
|
||||
void testValidInputs() {
|
||||
BigInteger r = BigInteger.ONE;
|
||||
BigInteger s = BigInteger.TEN;
|
||||
BigInteger yParity = BigInteger.ONE;
|
||||
byte yParity = (byte) 1;
|
||||
|
||||
CodeDelegationSignature result = CodeDelegationSignature.create(r, s, yParity);
|
||||
|
||||
assertThat(r).isEqualTo(result.getR());
|
||||
assertThat(s).isEqualTo(result.getS());
|
||||
assertThat(yParity.byteValue()).isEqualTo(result.getRecId());
|
||||
assertThat(yParity).isEqualTo(result.getRecId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNullRValue() {
|
||||
BigInteger s = BigInteger.TEN;
|
||||
BigInteger yParity = BigInteger.ZERO;
|
||||
byte yParity = (byte) 0;
|
||||
|
||||
assertThatExceptionOfType(NullPointerException.class)
|
||||
.isThrownBy(() -> CodeDelegationSignature.create(null, s, yParity));
|
||||
@@ -50,7 +50,7 @@ class CodeDelegationSignatureTest {
|
||||
@Test
|
||||
void testNullSValue() {
|
||||
BigInteger r = BigInteger.ONE;
|
||||
BigInteger yParity = BigInteger.ZERO;
|
||||
byte yParity = (byte) 0;
|
||||
|
||||
assertThatExceptionOfType(NullPointerException.class)
|
||||
.isThrownBy(() -> CodeDelegationSignature.create(r, null, yParity));
|
||||
@@ -60,7 +60,7 @@ class CodeDelegationSignatureTest {
|
||||
void testRValueExceedsTwoPow256() {
|
||||
BigInteger r = TWO_POW_256;
|
||||
BigInteger s = BigInteger.TEN;
|
||||
BigInteger yParity = BigInteger.ZERO;
|
||||
byte yParity = (byte) 0;
|
||||
|
||||
assertThatExceptionOfType(IllegalArgumentException.class)
|
||||
.isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity))
|
||||
@@ -71,34 +71,23 @@ class CodeDelegationSignatureTest {
|
||||
void testSValueExceedsTwoPow256() {
|
||||
BigInteger r = BigInteger.ONE;
|
||||
BigInteger s = TWO_POW_256;
|
||||
BigInteger yParity = BigInteger.ZERO;
|
||||
byte yParity = (byte) 0;
|
||||
|
||||
assertThatExceptionOfType(IllegalArgumentException.class)
|
||||
.isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity))
|
||||
.withMessageContainingAll("Invalid 's' value, should be < 2^256");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testYParityExceedsTwoPow256() {
|
||||
BigInteger r = BigInteger.ONE;
|
||||
BigInteger s = BigInteger.TWO;
|
||||
BigInteger yParity = TWO_POW_256;
|
||||
|
||||
assertThatExceptionOfType(IllegalArgumentException.class)
|
||||
.isThrownBy(() -> CodeDelegationSignature.create(r, s, yParity))
|
||||
.withMessageContainingAll("Invalid 'yParity' value, should be < 2^256");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testValidYParityZero() {
|
||||
BigInteger r = BigInteger.ONE;
|
||||
BigInteger s = BigInteger.TEN;
|
||||
BigInteger yParity = BigInteger.ZERO;
|
||||
byte yParity = (byte) 0;
|
||||
|
||||
CodeDelegationSignature result = CodeDelegationSignature.create(r, s, yParity);
|
||||
|
||||
assertThat(r).isEqualTo(result.getR());
|
||||
assertThat(s).isEqualTo(result.getS());
|
||||
assertThat(yParity.byteValue()).isEqualTo(result.getRecId());
|
||||
assertThat(yParity).isEqualTo(result.getRecId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user