Skip to content

Commit

Permalink
fix(relayer): use erc20vault not token vault for required end var (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Aug 15, 2023
1 parent c820166 commit a49c65c
Show file tree
Hide file tree
Showing 9 changed files with 416 additions and 339 deletions.
38 changes: 27 additions & 11 deletions packages/eventindexer/ProverPool.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"anonymous": false,
"inputs": [
{
"indexed": false,
"indexed": true,
"internalType": "address",
"name": "addressManager",
"type": "address"
Expand Down Expand Up @@ -117,6 +117,12 @@
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint64",
"name": "blockId",
"type": "uint64"
},
{
"indexed": true,
"internalType": "address",
Expand Down Expand Up @@ -198,25 +204,25 @@
},
{
"inputs": [],
"name": "MAX_CAPACITY_LOWER_BOUND",
"name": "MAX_NUM_PROVERS",
"outputs": [
{
"internalType": "uint32",
"internalType": "uint256",
"name": "",
"type": "uint32"
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_NUM_PROVERS",
"name": "MIN_CAPACITY",
"outputs": [
{
"internalType": "uint256",
"internalType": "uint32",
"name": "",
"type": "uint256"
"type": "uint32"
}
],
"stateMutability": "view",
Expand All @@ -237,7 +243,7 @@
},
{
"inputs": [],
"name": "MIN_SLASH_AMOUNT",
"name": "MIN_STAKE_PER_CAPACITY",
"outputs": [
{
"internalType": "uint64",
Expand All @@ -250,7 +256,7 @@
},
{
"inputs": [],
"name": "MIN_STAKE_PER_CAPACITY",
"name": "SLASH_MULTIPLIER",
"outputs": [
{
"internalType": "uint64",
Expand Down Expand Up @@ -574,7 +580,7 @@
"outputs": [
{
"internalType": "address payable",
"name": "",
"name": "addr",
"type": "address"
}
],
Expand All @@ -598,7 +604,7 @@
"outputs": [
{
"internalType": "address payable",
"name": "",
"name": "addr",
"type": "address"
}
],
Expand All @@ -620,10 +626,20 @@
},
{
"inputs": [
{
"internalType": "uint64",
"name": "blockId",
"type": "uint64"
},
{
"internalType": "address",
"name": "addr",
"type": "address"
},
{
"internalType": "uint64",
"name": "proofReward",
"type": "uint64"
}
],
"name": "slashProver",
Expand Down
33 changes: 24 additions & 9 deletions packages/eventindexer/TaikoL1.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@
},
{
"inputs": [],
"name": "L1_INVALID_PROOF",
"name": "L1_NOT_BETTER_BID",
"type": "error"
},
{
"inputs": [],
"name": "L1_NOT_BETTER_BID",
"name": "L1_NOT_PROVEABLE",
"type": "error"
},
{
Expand All @@ -158,12 +158,17 @@
},
{
"inputs": [],
"name": "L1_NOT_PROVEABLE",
"name": "L1_NOT_SPECIAL_PROVER",
"type": "error"
},
{
"inputs": [],
"name": "L1_NOT_SPECIAL_PROVER",
"name": "L1_PERMISSION_DENIED",
"type": "error"
},
{
"inputs": [],
"name": "L1_PERMISSION_DENIED",
"type": "error"
},
{
Expand Down Expand Up @@ -276,7 +281,7 @@
"anonymous": false,
"inputs": [
{
"indexed": false,
"indexed": true,
"internalType": "address",
"name": "addressManager",
"type": "address"
Expand Down Expand Up @@ -1041,6 +1046,11 @@
"name": "proofMaxWindow",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "proofWindowMultiplier",
"type": "uint16"
},
{
"internalType": "uint256",
"name": "ethDepositRingBufferSize",
Expand Down Expand Up @@ -1082,9 +1092,14 @@
"type": "uint8"
},
{
"internalType": "uint256",
"internalType": "uint32",
"name": "rewardOpenMaxCount",
"type": "uint256"
"type": "uint32"
},
{
"internalType": "uint32",
"name": "rewardMaxDelayPenalty",
"type": "uint32"
}
],
"internalType": "struct TaikoData.Config",
Expand Down Expand Up @@ -1473,7 +1488,7 @@
"outputs": [
{
"internalType": "address payable",
"name": "",
"name": "addr",
"type": "address"
}
],
Expand All @@ -1497,7 +1512,7 @@
"outputs": [
{
"internalType": "address payable",
"name": "",
"name": "addr",
"type": "address"
}
],
Expand Down
417 changes: 216 additions & 201 deletions packages/eventindexer/contracts/bridge/Bridge.go

Large diffs are not rendered by default.

201 changes: 110 additions & 91 deletions packages/eventindexer/contracts/proverpool/ProverPool.go

Large diffs are not rendered by default.

48 changes: 30 additions & 18 deletions packages/eventindexer/contracts/taikol1/TaikoL1.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/eventindexer/indexer/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func L1FilterFunc(

if svc.proverPool != nil {
wg.Go(func() error {
slashedEvents, err := svc.proverPool.FilterSlashed(filterOpts, nil)
slashedEvents, err := svc.proverPool.FilterSlashed(filterOpts, nil, nil)
if err != nil {
return errors.Wrap(err, "svc.proverPool.FilterSlashed")
}
Expand Down
8 changes: 4 additions & 4 deletions packages/eventindexer/indexer/save_message_sent_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (svc *Service) saveMessageSentEvents(
for {
event := events.Event

slog.Info("new messageSent event", "owner", event.Message.Owner.Hex())
slog.Info("new messageSent event", "owner", event.Message.From.Hex())

if err := svc.saveMessageSentEvent(ctx, chainID, event); err != nil {
eventindexer.MessageSentEventsProcessedError.Inc()
Expand All @@ -57,10 +57,10 @@ func (svc *Service) saveMessageSentEvent(
}

// amount must be >= 0.15 eth
if event.Message.DepositValue.Cmp(minEthAmount) < 0 {
if event.Message.Value.Cmp(minEthAmount) < 0 {
slog.Info("skipping message sent event",
"value",
event.Message.DepositValue.String(),
event.Message.Value.String(),
"requiredValue",
minEthAmount.String(),
)
Expand All @@ -78,7 +78,7 @@ func (svc *Service) saveMessageSentEvent(
Data: string(marshaled),
ChainID: chainID,
Event: eventindexer.EventNameMessageSent,
Address: event.Message.Owner.Hex(),
Address: event.Message.From.Hex(),
})
if err != nil {
return errors.Wrap(err, "svc.eventRepo.Save")
Expand Down
4 changes: 2 additions & 2 deletions packages/eventindexer/indexer/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (svc *Service) subscribeSlashed(

return svc.proverPool.WatchSlashed(&bind.WatchOpts{
Context: ctx,
}, sink, nil)
}, sink, nil, nil)
})

defer sub.Unsubscribe()
Expand Down Expand Up @@ -589,7 +589,7 @@ func (svc *Service) subscribeMessageSent(ctx context.Context, chainID *big.Int,
errChan <- errors.Wrap(err, "sub.Err()")
case event := <-sink:
go func() {
slog.Info("messageSentEvent", "owner", event.Message.Owner.Hex())
slog.Info("messageSentEvent", "owner", event.Message.From.Hex())

if err := svc.saveMessageSentEvent(ctx, chainID, event); err != nil {
eventindexer.MessageSentEventsProcessedError.Inc()
Expand Down
4 changes: 2 additions & 2 deletions packages/relayer/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var (
"L1_BRIDGE_ADDRESS",
"L2_BRIDGE_ADDRESS",
"L2_TAIKO_ADDRESS",
"L1_TOKEN_VAULT_ADDRESS",
"L2_TOKEN_VAULT_ADDRESS",
"L1_ERC20_VAULT_ADDRESS",
"L2_ERC20_VAULT_ADDRESS",
"L1_RPC_URL",
"L2_RPC_URL",
"MYSQL_USER",
Expand Down

0 comments on commit a49c65c

Please sign in to comment.