Skip to content

Commit

Permalink
Merge pull request OffchainLabs#510 from OffchainLabs/unmarshall-arbi…
Browse files Browse the repository at this point in the history
…trum-tx-types

Support marshalling & unmarshalling arbitrum tx types
  • Loading branch information
hkalodner authored Apr 12, 2022
2 parents 00b0128 + fc177cd commit b7d6484
Show file tree
Hide file tree
Showing 23 changed files with 54 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ target/
yarn-error.log
das/dasrpc/wireFormat.pb.go
das/dasrpc/wireFormat_grpc.pb.go

local/
4 changes: 2 additions & 2 deletions arbnode/inbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ func TestTransactionStreamer(t *testing.T) {
}
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbos/addressSet/addressSet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func size(t *testing.T, aset *AddressSet) uint64 {
return size
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbos/addressTable/addressTable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ func size(t *testing.T, atab *AddressTable) uint64 {
return size
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbos/arbosState/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/offchainlabs/nitro/util/testhelpers"
)

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbos/blockhash/blockhash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ func TestBlockhash(t *testing.T) {

}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbos/blsTable/bls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func TestLegacyBLS(t *testing.T) {
}
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbos/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/offchainlabs/nitro/util/testhelpers"
)

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion arbos/internal_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func InternalTxStartBlock(
}
return &types.ArbitrumInternalTx{
ChainId: chainId,
Type: arbInternalTxStartBlock,
SubType: arbInternalTxStartBlock,
Data: data,
L2BlockNumber: l2BlockNum,
}
Expand Down
4 changes: 2 additions & 2 deletions arbos/l1pricing/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/offchainlabs/nitro/util/testhelpers"
)

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbos/l2pricing/l2pricing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ func rateEstimate(t *testing.T, pricing *L2PricingState) uint64 {
return value
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions arbstate/geth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func RunMessagesThroughAPI(t *testing.T, msgs [][]byte, statedb *state.StateDB)
}
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
7 changes: 4 additions & 3 deletions blsSignatures/blsSignatures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
package blsSignatures

import (
"github.com/offchainlabs/nitro/util/testhelpers"
"testing"

"github.com/offchainlabs/nitro/util/testhelpers"
)

func TestValidSignature(t *testing.T) {
Expand Down Expand Up @@ -106,9 +107,9 @@ func TestSignatureAggregationDifferentMessages(t *testing.T) {
}
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions broadcaster/broadcaster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ func TestBroadcasterMessagesRemovedOnConfirmation(t *testing.T) {

}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions das/das_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ func TestDASMissingMessage(t *testing.T) {
}
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
4 changes: 2 additions & 2 deletions precompiles/ArbAddressTable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ func newMockEVMForTesting() *vm.EVM {
return evm
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func CreateTestL2WithConfig(t *testing.T, ctx context.Context, l2Info *Blockchai
return l2info, node, client
}

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, text ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
}
Expand Down
12 changes: 12 additions & 0 deletions system_tests/retryable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ func retryableSetup(t *testing.T) (
TransferBalance(t, "Faucet", "Burn", discard, l2info, l2client, ctx)

teardown := func() {

// check the integrity of the RPC
blockNum, err := l2client.BlockNumber(ctx)
Require(t, err, "failed to get L2 block number")
for number := uint64(0); number < blockNum; number++ {
block, err := l2client.BlockByNumber(ctx, arbmath.UintToBig(number))
Require(t, err, "failed to get L2 block", number, "of", blockNum)
if block.Number().Uint64() != number {
Fail(t, "block number mismatch", number, block.Number().Uint64())
}
}

cancel()
stack.Close()
}
Expand Down
4 changes: 2 additions & 2 deletions util/merkletree/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/offchainlabs/nitro/util/testhelpers"
)

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions util/testhelpers/testhelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
)

// Fail a test should an error occur
func RequireImpl(t *testing.T, err error, text ...string) {
func RequireImpl(t *testing.T, err error, printables ...interface{}) {
t.Helper()
if err != nil {
t.Fatal(colors.Red, text, err, colors.Clear)
t.Fatal(colors.Red, printables, err, colors.Clear)
}
}

Expand Down
4 changes: 2 additions & 2 deletions validator/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/offchainlabs/nitro/util/testhelpers"
)

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions zeroheavy/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/offchainlabs/nitro/util/testhelpers"
)

func Require(t *testing.T, err error, text ...string) {
func Require(t *testing.T, err error, printables ...interface{}) {
t.Helper()
testhelpers.RequireImpl(t, err, text...)
testhelpers.RequireImpl(t, err, printables...)
}

func Fail(t *testing.T, printables ...interface{}) {
Expand Down

0 comments on commit b7d6484

Please sign in to comment.