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

Fixes for empty messages - Work in progress. #1978

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions go/enclave/nodetype/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ func (s *sequencer) createGenesisBatch(ctx context.Context, block *common.L1Bloc
}

if len(cb.Receipts) == 0 || cb.Receipts[0].TxHash.Hex() != msgBusTx.Hash().Hex() {
err = fmt.Errorf("message Bus contract not minted - no receipts in batch")
err = fmt.Errorf("MessageBus contract not created - no receipts in batch")
s.logger.Error(err.Error())
return err
}

s.logger.Info("Message Bus Contract minted successfully", "address", cb.Receipts[0].ContractAddress.Hex())
s.logger.Info("MessageBus Contract created successfully", "address", cb.Receipts[0].ContractAddress.Hex())

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion integration/erc20contract/ObsERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface IMessageBus {
// where access to data has to be restricted.
contract ObsERC20 is ERC20 {

address bridge = 0xdeB34A740ECa1eC42C8b8204CBEC0bA34FDD27f3;
address bridge = 0x0a0Aaf0A52a9FDD0b034fe9031A4880dBDC1c480;

IMessageBus bus;

Expand Down
2 changes: 1 addition & 1 deletion integration/erc20contract/bin/ERC20.bin

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration/erc20contract/bin/ObsERC20.bin

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions integration/erc20contract/generated/ObsERC20/ObsERC20.go

Large diffs are not rendered by default.

29 changes: 28 additions & 1 deletion integration/simulation/transaction_injector.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func (ti *TransactionInjector) Start() {
return nil
})

wg.Go(func() error {
ti.issueRandomL2toL1Messages()
return nil
})

wg.Go(func() error {
ti.issueRandomValueTransfers()
return nil
Expand Down Expand Up @@ -236,14 +241,35 @@ func (ti *TransactionInjector) issueRandomTransfers() {
if err != nil {
ti.logger.Info("Failed to issue transfer via RPC.", log.ErrKey, err)
}

// todo (@pedro) - retrieve receipt

go ti.TxTracker.trackTransferL2Tx(signedTx)
sleepRndBtw(ti.avgBlockDuration/100, ti.avgBlockDuration/20)
}
}

func (ti *TransactionInjector) issueRandomL2toL1Messages() {
for txCounter := 0; ti.shouldKeepIssuing(txCounter); txCounter++ {
fromWallet := ti.rndObsWallet()
toWallet := gethcommon.HexToAddress("0x0a0Aaf0A52a9FDD0b034fe9031A4880dBDC1c480")
obscuroClient := ti.rpcHandles.ObscuroWalletRndClient(fromWallet)

tx := ti.newObscuroTransferTx(fromWallet, toWallet, testcommon.RndBtw(1, 500), testcommon.HOC)
tx = obscuroClient.EstimateGasAndGasPrice(tx)
signedTx, err := fromWallet.SignTransaction(tx)
if err != nil {
panic(err)
}

err = obscuroClient.SendTransaction(ti.ctx, signedTx)
if err != nil {
ti.logger.Info("Failed to issue transfer via RPC.", log.ErrKey, err)
}

sleepRndBtw(ti.avgBlockDuration/100, ti.avgBlockDuration/20)
}
}

func (ti *TransactionInjector) bridgeRandomGasTransfers() {
gasWallet := ti.wallets.GasBridgeWallet

Expand Down Expand Up @@ -315,6 +341,7 @@ func (ti *TransactionInjector) issueRandomDeposits() {
} else {
go ti.TxTracker.trackTransferL2Tx(signedTx)
}

// todo (@pedro) - retrieve receipt

sleepRndBtw(ti.avgBlockDuration/3, ti.avgBlockDuration)
Expand Down
3 changes: 2 additions & 1 deletion integration/simulation/validate_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,11 @@

totalSuccessfullyWithdrawn := extractWithdrawals(t, obscuroClient, nodeIdx)

/* -- this doesn't work anymore; gas bridging has replaced it.
totalAmountLogged := getLoggedWithdrawals(minObscuroHeight, obscuroClient, headBatchHeader)
if totalAmountLogged.Cmp(totalSuccessfullyWithdrawn) != 0 {
t.Errorf("Node %d: Logged withdrawals do not match!", nodeIdx)
}
} */

injectorDepositedAmt := big.NewInt(0)
for _, tx := range s.TxInjector.TxTracker.GetL1Transactions() {
Expand Down Expand Up @@ -440,7 +441,7 @@
}
}

func getLoggedWithdrawals(minObscuroHeight uint64, obscuroClient *obsclient.ObsClient, currentHeader *common.BatchHeader) *big.Int {

Check failure on line 444 in integration/simulation/validate_chain.go

View workflow job for this annotation

GitHub Actions / lint

func `getLoggedWithdrawals` is unused (unused)
totalAmountLogged := big.NewInt(0)
for i := minObscuroHeight; i < currentHeader.Number.Uint64(); i++ {
header, err := obscuroClient.GetBatchHeaderByNumber(big.NewInt(int64(i)))
Expand Down
Loading