Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP-2930: Access List Transactions #1712

Merged
merged 128 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
26cea0e
first pass at removing AcceptedTypes
RatanRSur Dec 12, 2020
2f4929a
add transaction type stuff to transaction
RatanRSur Dec 12, 2020
ffcc704
rlp decoder/encoder changes
RatanRSur Dec 12, 2020
64d92be
mainly test changes
RatanRSur Dec 12, 2020
f3496bb
spotless
RatanRSur Dec 12, 2020
ecc4957
fix tests
RatanRSur Dec 13, 2020
7e88e78
better error message and fix integration test
RatanRSur Dec 13, 2020
1d8292c
spotless
RatanRSur Dec 13, 2020
fff211d
actually fix integration test this time
RatanRSur Dec 13, 2020
9983c7e
some acceptance test fixes
RatanRSur Dec 14, 2020
461352e
Merge branch 'master' of github.com:hyperledger/besu into eip-1559-tr…
RatanRSur Dec 14, 2020
3a37559
bring over some eip-2930 stuff
RatanRSur Dec 14, 2020
9833a38
access list class
RatanRSur Dec 10, 2020
08d6eae
bring accesListSigningMessage over
RatanRSur Dec 14, 2020
5e9b036
get to the point where the signature fails
RatanRSur Dec 14, 2020
bc4bc16
Merge branch 'master' of github.com:hyperledger/besu into eip-2930-ta…
RatanRSur Dec 14, 2020
118b1f7
remove get
RatanRSur Dec 14, 2020
5939829
signature encoding/decoding
RatanRSur Dec 14, 2020
adaf71f
plugin-hash and spotless
RatanRSur Dec 14, 2020
b92914b
wire access list through to message frame and calculate gas costs
RatanRSur Dec 14, 2020
505f3fe
remove todo
RatanRSur Dec 14, 2020
45e7358
enable support for access lists in berlin
RatanRSur Dec 14, 2020
41391bc
Merge branch 'master' of github.com:hyperledger/besu into eip-2930
RatanRSur Dec 15, 2020
420a918
rename intrinsic gas cost method and optimize accessed state gas cost…
RatanRSur Dec 15, 2020
6f11e7f
fix MainnetTransactionValidatorTest
RatanRSur Dec 15, 2020
67718d9
fix NPE in DefaultPrivacyControllerTest
RatanRSur Dec 15, 2020
67e584d
rename
RatanRSur Dec 15, 2020
1f36f8e
actually warm everything up
RatanRSur Dec 15, 2020
f7a5763
renames
RatanRSur Dec 15, 2020
28661b8
remove todo
RatanRSur Dec 15, 2020
c20b6d5
add type guesser
RatanRSur Dec 15, 2020
0b60d10
make assertion comply with new class
RatanRSur Dec 15, 2020
5352f4b
type guess test
RatanRSur Dec 15, 2020
9ff9670
warm up everything in one pass
RatanRSur Dec 16, 2020
0f3f638
Merge branch 'master' of github.com:hyperledger/besu into eip-2930
RatanRSur Dec 16, 2020
05d7d75
typo
RatanRSur Dec 16, 2020
8c3ee4c
spotless
RatanRSur Dec 16, 2020
1e81c0b
some test fixes
RatanRSur Dec 16, 2020
c6c16f1
spotless
RatanRSur Dec 16, 2020
4b3b631
go back to wrap
RatanRSur Dec 16, 2020
ef843dd
wrap bytes properly
RatanRSur Dec 16, 2020
17aa80c
add TransactionType to BlockOptions
RatanRSur Dec 16, 2020
cf0cffe
REPLACE STATE ROOTS
RatanRSur Dec 17, 2020
1c500ae
don't generate gas price for EIP-1559 transaction
RatanRSur Dec 17, 2020
df5244b
fix hardcoded index
RatanRSur Dec 17, 2020
79eed1d
fix brittle test again
RatanRSur Dec 17, 2020
2782623
remove unnecessary test
RatanRSur Dec 17, 2020
8b4cbae
private
RatanRSur Dec 17, 2020
00f7c7b
fix limited message test
RatanRSur Jan 4, 2021
75a8056
transactions generator change
RatanRSur Jan 4, 2021
248cfe4
Merge branch 'master' of github.com:hyperledger/besu into transaction…
RatanRSur Jan 4, 2021
2c6ea09
simplify condition
RatanRSur Jan 4, 2021
74467f4
unhardcode limits
RatanRSur Jan 4, 2021
b279692
Merge branch 'master' of github.com:hyperledger/besu into transaction…
RatanRSur Jan 5, 2021
09f2d99
Merge branch 'master' of github.com:hyperledger/besu into eip-2930
RatanRSur Jan 5, 2021
513265f
Merge branch 'transaction-type-test-support' into eip-2930
RatanRSur Jan 5, 2021
c6948b1
add access list to block data generator
RatanRSur Jan 5, 2021
be1b027
use block data generator in roundtrip test
RatanRSur Jan 5, 2021
b61db6e
wrong stuff
RatanRSur Jan 5, 2021
0818cd1
new transaction encoding/decoding
RatanRSur Jan 5, 2021
1b88d32
transaction receipt generation with types
RatanRSur Jan 5, 2021
aaf0d87
fix receipt en/decoding
RatanRSur Jan 5, 2021
a1ceab7
Objects.equals
RatanRSur Jan 5, 2021
63d94df
Merge branch 'transaction-type-test-support' into eip-2930
RatanRSur Jan 5, 2021
2bfd9b3
add files and header deserialization
RatanRSur Jan 7, 2021
99c2856
misc
RatanRSur Jan 8, 2021
49e04f7
fix npe
RatanRSur Jan 11, 2021
c8aa450
change annotation order
RatanRSur Jan 11, 2021
4ea9a45
update tests
RatanRSur Jan 11, 2021
f028213
parsing files and failing!
RatanRSur Jan 12, 2021
27679b6
better test names
RatanRSur Jan 12, 2021
388af6e
revert field name changes to test files
RatanRSur Jan 12, 2021
fc147b1
assume chainId of 1 in json parsing
RatanRSur Jan 12, 2021
def3af6
read int scalar instead of byte
RatanRSur Jan 12, 2021
ebc0931
rename lambda parameter
RatanRSur Jan 12, 2021
5d81a5b
set v for access list transactions
RatanRSur Jan 12, 2021
ea5b1a9
properly compare v for equality
RatanRSur Jan 12, 2021
c81cfd8
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 12, 2021
67bb14b
deserialize receipts
RatanRSur Jan 12, 2021
16a576e
spotless
RatanRSur Jan 12, 2021
8e71db3
add roots test
RatanRSur Jan 12, 2021
ffeef76
remove println
RatanRSur Jan 12, 2021
383f306
add header
RatanRSur Jan 13, 2021
2848a0d
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 13, 2021
597a43f
multi-line comment
RatanRSur Jan 13, 2021
7371077
make encoding match decoding
RatanRSur Jan 13, 2021
79b8808
update test file
RatanRSur Jan 14, 2021
6c6ef6b
biginteger v type
RatanRSur Jan 14, 2021
cbde3c2
don't allow null transactions
RatanRSur Jan 14, 2021
e7afe11
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 14, 2021
da5d235
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 18, 2021
d3ef08e
fix ClassNotFoundException
RatanRSur Jan 18, 2021
74cbcb0
add clique dependency
RatanRSur Jan 19, 2021
102c2ef
wip: importing martin's blocks
RatanRSur Jan 20, 2021
3c22b46
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 20, 2021
1121c54
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 22, 2021
59ffd5b
new test files
RatanRSur Jan 22, 2021
56bd518
fix sender recovery for access list
RatanRSur Jan 22, 2021
8daade4
revert BlockchainSetupUtil changes
RatanRSur Jan 22, 2021
fee114b
only go through storage slots if account exists
RatanRSur Jan 22, 2021
e4b8165
change transaction trie and receipt trie values
RatanRSur Jan 26, 2021
56d4417
checkNotNull
RatanRSur Jan 26, 2021
cd5d47b
spotless
RatanRSur Jan 27, 2021
2f545ce
delete test class
RatanRSur Jan 27, 2021
0601199
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 27, 2021
5d5fa88
remove v setting
RatanRSur Jan 27, 2021
8427774
encode eip1559 as 2718 transaction
RatanRSur Jan 27, 2021
af6b5d5
remove print
RatanRSur Jan 27, 2021
dd02b6e
remove unnecessary check for frontier type
RatanRSur Jan 27, 2021
c2668d3
fix receipt reading
RatanRSur Jan 27, 2021
5a50a18
fix receipt writing/reading outside of trie
RatanRSur Jan 27, 2021
53a8227
plugin hash
RatanRSur Jan 27, 2021
25e3084
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Jan 27, 2021
31cc131
fix tests that brittly rely on block data generator
RatanRSur Jan 27, 2021
1ea2fea
fix brittle reorg test
RatanRSur Jan 27, 2021
221bf03
"fix" PrivacyReorgTest
RatanRSur Jan 28, 2021
da33fcc
remove @JsonIgnore
RatanRSur Jan 28, 2021
1f78dd9
rename
RatanRSur Jan 28, 2021
2d13848
rename rlpInput
RatanRSur Jan 28, 2021
e5a69db
add check back
RatanRSur Jan 28, 2021
81c6e8a
delete files from tests
RatanRSur Jan 28, 2021
3f76d51
spotless
RatanRSur Jan 28, 2021
f9f0663
another deletion
RatanRSur Jan 28, 2021
3662a2d
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Feb 1, 2021
0e8bd33
cleanup
RatanRSur Feb 1, 2021
74a3574
cleanup
RatanRSur Feb 1, 2021
4e9b625
Merge branch 'master' of https://github.com/hyperledger/besu into eip…
RatanRSur Feb 1, 2021
f8885d8
Merge branch 'master' into eip-2930
RatanRSur Feb 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions besu/src/test/java/org/hyperledger/besu/PrivacyReorgTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import org.junit.rules.TemporaryFolder;

@SuppressWarnings("rawtypes")
// todo request lucas look at this pr
public class PrivacyReorgTest {
@Rule public final TemporaryFolder folder = new TemporaryFolder();

Expand All @@ -92,9 +93,9 @@ public class PrivacyReorgTest {
Bytes.fromBase64String("A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=");

private static final String FIRST_BLOCK_WITH_NO_TRANSACTIONS_STATE_ROOT =
"0x1bdf13f6d14c7322d6e695498aab258949e55574bef7eac366eb777f43d7dd2b";
"0xc9dcaffbebc7edc20839c80e706430a8fa885e8f703bb89f6e95633cc2b05d4d";
private static final String FIRST_BLOCK_WITH_SINGLE_TRANSACTION_STATE_ROOT =
"0x16979b290f429e06d86a43584c7d8689d4292ade9a602e5c78e2867c6ebd904e";
"0x66fbc6ad12ef1da78740093ea2b3362e773e510e27d8f88b68c27bfc1f4d58c8";
private static final String BLOCK_WITH_SINGLE_TRANSACTION_RECEIPTS_ROOT =
"0xc8267b3f9ed36df3ff8adb51a6d030716f23eeb50270e7fce8d9822ffa7f0461";
private static final String STATE_ROOT_AFTER_TRANSACTION_APPENDED_TO_EMTPY_STATE =
Expand Down Expand Up @@ -260,7 +261,7 @@ public void reorgToShorterChain() {
gen.block(getBlockOptionsNoTransaction(blockchain.getGenesisBlock(), firstBlockStateRoot));

final String secondBlockStateRoot =
"0x35c315ee7d272e5b612d454ee87c948657310ab33208b57122f8d0525e91f35e";
"0x7e887f91d2a6205f4a643701aba022c2db0bac5ab235102ab7477edd7a8a4317";
final Block secondBlock =
gen.block(
getBlockOptionsWithTransaction(
Expand All @@ -287,7 +288,7 @@ public void reorgToShorterChain() {
.plus(blockchain.getBlockByNumber(2).get().getHeader().getDifficulty());

final String forkBlockStateRoot =
"0x4a33bdf9d16e6dd4f4c67f1638971f663f132ebceac0c7c65c9a3f35172af4de";
"0x486b886bde6472e8d706f8eb4fb6378ebbdceb4848a5a8d69a726575b22e41b6";
final Block forkBlock =
gen.block(
getBlockOptionsNoTransactionWithDifficulty(
Expand Down Expand Up @@ -337,7 +338,7 @@ public void reorgToLongerChain() {
privateStateRootResolver, blockchain, STATE_ROOT_AFTER_TRANSACTION_APPENDED_TO_EMTPY_STATE);

final String secondForkBlockStateRoot =
"0xd35eea814b8b5a0b12e690ab320785f3a33d9685bbf6875637c40a64203915da";
"0x57ccc80f4e50d2e669d82aefa7d3bbe763cf47df27665af14c90b2f8641953f5";
final Block secondForkBlock =
gen.block(
getBlockOptionsNoTransactionWithDifficulty(
Expand All @@ -355,7 +356,7 @@ public void reorgToLongerChain() {

// Add another private transaction
final String thirdForkBlockStateRoot =
"0xe22344ade05260177b79dcc6c4fed8f87ab95a506c2a6147631ac6547cf44846";
"0x8fe42678733e6099e7b10b9b1d4684b8f2ce3d6479cb122ea12932ef304a1793";
final Block thirdForkBlock =
gen.block(
getBlockOptionsWithTransactionAndDifficulty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,13 @@ public void getOmmerByBlockNumberAndIndexShouldReturnExpectedOmmerHeader() {
final BlockchainWithData data = setupBlockchain(3);
final BlockchainQueries queries = data.blockchainQueries;
final Block targetBlock = data.blockData.get(data.blockData.size() - 1).block;
final BlockHeader ommerBlockHeader = targetBlock.getBody().getOmmers().get(1);
final List<BlockHeader> ommers = targetBlock.getBody().getOmmers();
final int ommerIndex = ommers.size() - 1;

final BlockHeader retrievedOmmerBlockHeader =
queries.getOmmer(targetBlock.getHeader().getNumber(), 1).get();
queries.getOmmer(targetBlock.getHeader().getNumber(), ommerIndex).get();

assertThat(retrievedOmmerBlockHeader).isEqualTo(ommerBlockHeader);
assertThat(retrievedOmmerBlockHeader).isEqualTo(ommers.get(ommerIndex));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.math.BigInteger;

import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.BaseUInt256Value;
import org.apache.tuweni.units.bigints.UInt256;

Expand Down Expand Up @@ -61,7 +61,7 @@ public static Wei ofNumber(final Number value) {
return new Wei((BigInteger) value);
}

public static Wei wrap(final Bytes32 value) {
public static Wei wrap(final Bytes value) {
return new Wei(UInt256.fromBytes(value));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ static Transaction decodeFrontierOrEip1559(final RLPInput input) {
} else {
// otherwise this is an EIP-1559 transaction
builder.type(TransactionType.EIP1559);
builder
.gasPremium(Wei.of(maybeGasPremiumOrV.toBigInteger()))
.feeCap(Wei.of(maybeFeeCapOrR.toBigInteger()));
builder.gasPremium(Wei.wrap(maybeGasPremiumOrV)).feeCap(Wei.wrap(maybeFeeCapOrR));
v = maybeVOrS.toBigInteger();
r = input.readUInt256Scalar().toBytes().toUnsignedBigInteger();
s = input.readUInt256Scalar().toBytes().toUnsignedBigInteger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static com.google.common.base.Preconditions.checkNotNull;

import org.hyperledger.besu.config.experimental.ExperimentalEIPs;
import org.hyperledger.besu.ethereum.core.AccessList;
import org.hyperledger.besu.ethereum.core.Address;
import org.hyperledger.besu.ethereum.core.Transaction;
Expand Down Expand Up @@ -151,8 +150,6 @@ public static void encodeAccessListInner(
}

static void encodeEIP1559(final Transaction transaction, final RLPOutput out) {
ExperimentalEIPs.eip1559MustBeEnabled();

out.startList();
out.writeLongScalar(transaction.getNonce());
out.writeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package org.hyperledger.besu.ethereum.core;

import static com.google.common.base.Preconditions.checkArgument;
import static java.util.stream.Collectors.toSet;
import static java.util.stream.Collectors.toUnmodifiableSet;

import org.hyperledger.besu.crypto.SECP256K1;
import org.hyperledger.besu.crypto.SecureRandomProvider;
Expand All @@ -42,7 +42,6 @@
import java.util.Random;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import com.google.common.base.Supplier;
Expand Down Expand Up @@ -304,8 +303,8 @@ public BlockBody body(final BlockOptions options) {
}
final List<Transaction> defaultTxs = new ArrayList<>();
if (options.hasTransactions()) {
defaultTxs.add(transaction());
defaultTxs.add(transaction());
defaultTxs.add(transaction(options.getTransactionTypes()));
defaultTxs.add(transaction(options.getTransactionTypes()));
}

return new BlockBody(options.getTransactions(defaultTxs), ommers);
Expand All @@ -315,17 +314,66 @@ private BlockHeader ommer() {
return header(positiveLong(), body(BlockOptions.create().hasOmmers(false)));
}

private TransactionType transactionType() {
return transactionType(TransactionType.values());
}

private TransactionType transactionType(final TransactionType... transactionTypes) {
return transactionTypes[random.nextInt(transactionTypes.length)];
}

public Transaction transaction() {
return transaction(bytes32());
return transaction(transactionType());
}

public Transaction transaction(final TransactionType... transactionTypes) {
return transaction(transactionType(transactionTypes));
}

public Transaction transaction(final TransactionType transactionType) {
return transaction(transactionType, bytes32(), address());
}

public Transaction transaction(final Bytes payload) {
return transaction(payload, address());
return transaction(transactionType(), payload);
}

public Transaction transaction(final Bytes payload, final Address to) {
public Transaction transaction(final TransactionType transactionType, final Bytes payload) {
return transaction(transactionType, payload, address());
}

public Transaction transaction(
final TransactionType transactionType, final Bytes payload, final Address to) {
switch (transactionType) {
case FRONTIER:
return frontierTransaction(payload, to);
case EIP1559:
return eip1559Transaction(payload, to);
default:
throw new RuntimeException(
String.format(
"Developer Error. No random transaction generator defined for %s",
transactionType));
}
}

private Transaction eip1559Transaction(final Bytes payload, final Address to) {
return Transaction.builder()
.type(TransactionType.EIP1559)
.nonce(positiveLong())
.gasPrice(Wei.ZERO)
.gasPremium(Wei.wrap(bytes32()))
.feeCap(Wei.wrap(bytes32()))
.gasLimit(positiveLong())
.to(to)
.value(Wei.of(positiveLong()))
.payload(payload)
.chainId(BigInteger.ONE)
.signAndBuild(generateKeyPair());
}

private Transaction frontierTransaction(final Bytes payload, final Address to) {
return Transaction.builder()
// TODO support more EIP-2718 types as they're added
.type(TransactionType.FRONTIER)
.nonce(positiveLong())
.gasPrice(Wei.wrap(bytes32()))
Expand All @@ -337,32 +385,15 @@ public Transaction transaction(final Bytes payload, final Address to) {
.signAndBuild(generateKeyPair());
}

public Set<Transaction> transactions(final int n, final TransactionType... transactionTypes) {
return Stream.generate(() -> transaction(transactionTypes))
.parallel()
.limit(n)
.collect(toUnmodifiableSet());
}

public Set<Transaction> transactions(final int n) {
Wei gasPrice = Wei.wrap(bytes32());
long gasLimit = positiveLong();
Address to = address();
Wei value = Wei.wrap(bytes32());
int chainId = 1;
Bytes32 payload = bytes32();
final SECP256K1.Signature signature = SECP256K1.sign(payload, generateKeyPair());

final Set<Transaction> txs =
IntStream.range(0, n)
.parallel()
.mapToObj(
v ->
new Transaction(
v,
gasPrice,
gasLimit,
Optional.of(to),
value,
signature,
payload,
to,
Optional.of(BigInteger.valueOf(chainId))))
.collect(toSet());
return txs;
return transactions(n, TransactionType.values());
}

public TransactionReceipt receipt(final long cumulativeGasUsed) {
Expand Down Expand Up @@ -521,6 +552,7 @@ public static class BlockOptions {
private Optional<Long> timestamp = Optional.empty();
private boolean hasOmmers = true;
private boolean hasTransactions = true;
private TransactionType[] transactionTypes = TransactionType.values();

public static BlockOptions create() {
return new BlockOptions();
Expand All @@ -530,6 +562,10 @@ public List<Transaction> getTransactions(final List<Transaction> defaultValue) {
return transactions.isEmpty() ? defaultValue : transactions;
}

public TransactionType[] getTransactionTypes() {
return transactionTypes;
}

public List<BlockHeader> getOmmers(final List<BlockHeader> defaultValue) {
return ommers.isEmpty() ? defaultValue : ommers;
}
Expand Down Expand Up @@ -646,6 +682,11 @@ public BlockOptions hasTransactions(final boolean hasTransactions) {
return this;
}

public BlockOptions transactionTypes(final TransactionType... transactionTypes) {
this.transactionTypes = transactionTypes;
return this;
}

public BlockOptions hasOmmers(final boolean hasOmmers) {
this.hasOmmers = hasOmmers;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toUnmodifiableList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import org.hyperledger.besu.config.experimental.ExperimentalEIPs;
import org.hyperledger.besu.crypto.SECP256K1;
Expand Down Expand Up @@ -85,19 +84,6 @@ public void encodeEIP1559TxNominalCase() {
ExperimentalEIPs.eip1559Enabled = ExperimentalEIPs.EIP1559_ENABLED_DEFAULT_VALUE;
}

@Test
public void encodeEIP1559TxFailureNotEnabled() {
ExperimentalEIPs.eip1559Enabled = false;
assertThatThrownBy(
() ->
TransactionRLPEncoder.encode(
TransactionRLPDecoder.decode(RLP.input(Bytes.fromHexString(EIP1559_TX_RLP))),
new BytesValueRLPOutput()))
.isInstanceOf(RuntimeException.class)
.hasMessageContaining("EIP-1559 feature flag");
ExperimentalEIPs.eip1559Enabled = ExperimentalEIPs.EIP1559_ENABLED_DEFAULT_VALUE;
}

@Test
public void blockBodyWithLegacyAndEIP2930TransactionsRoundTrips() {
final BlockDataGenerator gen = new BlockDataGenerator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static LimitedTransactionsMessages createLimited(
transaction.writeTo(encodedTransaction);
Bytes encodedBytes = encodedTransaction.encoded();
if (messageSize != 0 // always at least one message
&& (encodedBytes.size() > LIMIT || messageSize + encodedBytes.size() > LIMIT)) {
&& messageSize + encodedBytes.size() > LIMIT) {
break;
}
message.writeRaw(encodedBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class LimitedTransactionsMessagesTest {
@Test
public void createLimited() {
final Set<Transaction> transactions = generator.transactions(6000);

final Set<Transaction> remainingTransactions = new HashSet<>(transactions);

final LimitedTransactionsMessages firstMessage =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,7 @@ public void shouldSendTransactionsInBatchesWithLimit() throws Exception {
final Set<Transaction> firstBatch = getTransactionsFromMessage(sentMessages.get(0));
final Set<Transaction> secondBatch = getTransactionsFromMessage(sentMessages.get(1));

final int expectedFirstBatchSize = 5219, expectedSecondBatchSize = 781, toleranceDelta = 50;
assertThat(firstBatch)
.hasSizeBetween(
expectedFirstBatchSize - toleranceDelta, expectedFirstBatchSize + toleranceDelta);
assertThat(secondBatch)
.hasSizeBetween(
expectedSecondBatchSize - toleranceDelta, expectedSecondBatchSize + toleranceDelta);

assertThat(firstBatch).hasSizeGreaterThan(secondBatch.size());
assertThat(Sets.union(firstBatch, secondBatch)).isEqualTo(transactions);
}

Expand Down