Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip code delegation precompute if recId outside native lib's bounds
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Dudley <[email protected]>
siladu committed Jan 31, 2025
1 parent aae002a commit b81026d
Showing 2 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -45,11 +45,6 @@ public static CodeDelegationSignature create(
final BigInteger r, final BigInteger s, final byte yParity) {
checkNotNull(r);
checkNotNull(s);
final byte recId = yParity;
if (recId != 0 && recId != 1) {
throw new IllegalArgumentException(
"Invalid 'recId' value, should be 0 or 1 but got " + recId);
}

if (r.compareTo(TWO_POW_256) >= 0) {
throw new IllegalArgumentException(
Original file line number Diff line number Diff line change
@@ -412,19 +412,30 @@ private void precomputeAuthorities(final Transaction transaction) {
int index = 0;
for (final var codeDelegation : codeDelegations) {
final var constIndex = index++;
mergeCoordinator
.getEthScheduler()
.scheduleTxWorkerTask(
() -> {
final var authority = codeDelegation.authorizer();
LOG.atTrace()
.setMessage(
"The code delegation authority at index {} for transaction {} is calculated : {}")
.addArgument(constIndex)
.addArgument(transaction::getHash)
.addArgument(authority)
.log();
});
final byte recId = codeDelegation.signature().getRecId();
if (recId < 0 || recId > 3) {
LOG.atTrace()
.setMessage(
"The code delegation authority at index {} for transaction {} is skipped because recId : {}")
.addArgument(constIndex)
.addArgument(transaction::getHash)
.addArgument(recId)
.log();
} else {
mergeCoordinator
.getEthScheduler()
.scheduleTxWorkerTask(
() -> {
final var authority = codeDelegation.authorizer();
LOG.atTrace()
.setMessage(
"The code delegation authority at index {} for transaction {} is calculated : {}")
.addArgument(constIndex)
.addArgument(transaction::getHash)
.addArgument(authority)
.log();
});
}
}
}

0 comments on commit b81026d

Please sign in to comment.