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

Sync Relayer from previous Ethereum block #384

Merged
merged 16 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update types for main
  • Loading branch information
denalimarsh committed Jun 1, 2021
commit 5051300afbe8c5bc343309f165af8fe05d0376cf
4 changes: 2 additions & 2 deletions relayer/workers/beefyrelayer/beefy-ethereum-listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (li *BeefyEthereumListener) processHistoricalInitialVerificationSuccessfulE
items := li.beefyDB.GetItemsByStatus(store.CommitmentWitnessed)
for _, item := range items {
denalimarsh marked this conversation as resolved.
Show resolved Hide resolved
generatedPayload := li.simulatePayloadGeneration(*item)
if generatedPayload == validationData.Payload {
if generatedPayload == validationData.CommitmentHash {
// Update existing database item
li.log.Info("Updating item status from 'CommitmentWitnessed' to 'InitialVerificationTxConfirmed'")
instructions := map[string]interface{}{
Expand Down Expand Up @@ -295,7 +295,7 @@ func (li *BeefyEthereumListener) processHistoricalFinalVerificationSuccessfulEve
items := li.beefyDB.GetItemsByStatus(store.InitialVerificationTxConfirmed)
for _, item := range items {
denalimarsh marked this conversation as resolved.
Show resolved Hide resolved
generatedPayload := li.simulatePayloadGeneration(*item)
if generatedPayload == validationData.Payload {
if generatedPayload == validationData.CommitmentHash {
li.log.Info("Deleting finalized item from the database'")
deleteCmd := store.NewDatabaseCmd(item, store.Delete, nil)
li.dbMessages <- deleteCmd
Expand Down
2 changes: 1 addition & 1 deletion relayer/workers/beefyrelayer/store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func loadSampleBeefyRelayInfo() store.BeefyRelayInfo {
signedCommitment := store.SignedCommitment{
Commitment: store.Commitment{
Payload: types.NewH256(payloadBytes),
BlockNumber: types.BlockNumber(930),
BlockNumber: types.NewU32(930),
ValidatorSetID: types.NewU64(0),
},
Signatures: []store.OptionBeefySignature{
Expand Down
6 changes: 3 additions & 3 deletions relayer/workers/beefyrelayer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ func TestWriter(t *testing.T) {
// Set up config
config := ethereum.Config{}
config.Endpoint = "ws://localhost:8545/"
config.PrivateKey = "4e9444a6efd6d42725a250b650a781da2737ea308c839eaccb0f7f3dbd2fea77"
config.BeefyPrivateKey = "4e9444a6efd6d42725a250b650a781da2737ea308c839eaccb0f7f3dbd2fea77"
config.LightClientBridge = "0x8cF6147918A5CBb672703F879f385036f8793a24"

kpEth, err := secp256k1.NewKeypairFromString(config.PrivateKey)
kpEth, err := secp256k1.NewKeypairFromString(config.BeefyPrivateKey)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -166,7 +166,7 @@ func loadSampleBeefyRelayInfo() store.BeefyRelayInfo {
signedCommitment := store.SignedCommitment{
Commitment: store.Commitment{
Payload: types.NewH256(payloadBytes),
BlockNumber: types.BlockNumber(930),
BlockNumber: types.NewU32(930),
ValidatorSetID: types.NewU64(0),
},
Signatures: []store.OptionBeefySignature{
Expand Down