Skip to content

Commit

Permalink
Fix withdrawals tests by changing encoding/encoding to use UInt64 sca…
Browse files Browse the repository at this point in the history
…lar for RLP instead of long scalar

Signed-off-by: Jason Frame <jason.frame@consensys.net>
  • Loading branch information
jframe committed Jan 17, 2023
1 parent f5a3201 commit a7c96ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class WithdrawalDecoder {

public static Withdrawal decode(final RLPInput rlpInput) {
rlpInput.enterList();
final UInt64 index = UInt64.valueOf(rlpInput.readBigIntegerScalar());
final UInt64 validatorIndex = UInt64.valueOf(rlpInput.readBigIntegerScalar());
final UInt64 index = rlpInput.readUInt64Scalar();
final UInt64 validatorIndex = rlpInput.readUInt64Scalar();
final Address address = Address.readFrom(rlpInput);
final GWei amount = GWei.of(rlpInput.readUInt64Scalar());
rlpInput.leaveList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public static Bytes encodeOpaqueBytes(final Withdrawal withdrawal) {

public static void encode(final Withdrawal withdrawal, final RLPOutput rlpOutput) {
rlpOutput.startList();
rlpOutput.writeLongScalar(withdrawal.getIndex().toLong());
rlpOutput.writeLongScalar(withdrawal.getValidatorIndex().toLong());
rlpOutput.writeUInt64Scalar(withdrawal.getIndex());
rlpOutput.writeUInt64Scalar(withdrawal.getValidatorIndex());
rlpOutput.writeBytes(withdrawal.getAddress());
rlpOutput.writeUInt64Scalar(withdrawal.getAmount());
rlpOutput.endList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@

import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt64;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

@Disabled
class WithdrawalEncoderTest {
public static final String WITHDRAWAL_ZERO_CASE =
"0xd8808094000000000000000000000000000000000000000080";
Expand Down

0 comments on commit a7c96ca

Please sign in to comment.