Skip to content

Commit

Permalink
Merge branch 'andrius/support-relay-upgrade-sgb' into 'main'
Browse files Browse the repository at this point in the history
Temp change to Support Relay upgrade on SGB this reward epoch.

See merge request flarenetwork/flare-system-client!44
  • Loading branch information
GrePod committed Oct 14, 2024
2 parents 3b831a6 + 861f329 commit cb53d0c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions client/finalizer/relay_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/ecdsa"
"flare-tlc/client/config"
"flare-tlc/client/shared"
"flare-tlc/database"
"flare-tlc/logger"
"flare-tlc/utils/chain"
"flare-tlc/utils/contracts/relay"
Expand Down Expand Up @@ -99,13 +100,30 @@ func NewRelayContractClient(
}

func (r *relayContractClient) FetchSigningPolicies(db finalizerDB, from, to int64) ([]signingPolicyListenerResponse, error) {
var allLogs []database.Log

// TEMP CHANGE for upgrading Relay contract, should be removed after 17 Oct 2024

// If using new Songbird Relay, query the old one as well.
// Note: this won't have any effect on other networks as we currently have unique Relay addresses for each network.
if r.address == common.HexToAddress("0x0D462d2Fec11554D64F52D7c5A5C269d748037aD") {
logsOld, err := db.FetchLogsByAddressAndTopic0(common.HexToAddress("0xbA35e39D01A3f5710d1e43FC61dbb738B68641c4"), r.topic0SPI, from, to)
if err != nil {
return nil, err
}
allLogs = append(allLogs, logsOld...)
}
// END TEMP CHANGE

logs, err := db.FetchLogsByAddressAndTopic0(r.address, r.topic0SPI, from, to)
if err != nil {
return nil, err
}

result := make([]signingPolicyListenerResponse, 0, len(logs))
for _, log := range logs {
allLogs = append(allLogs, logs...)

result := make([]signingPolicyListenerResponse, 0, len(allLogs))
for _, log := range allLogs {
policyData, err := shared.ParseSigningPolicyInitializedEvent(r.relay, log)
if err != nil {
logger.Error("Error parsing SigningPolicyInitialized event %v", err)
Expand Down

0 comments on commit cb53d0c

Please sign in to comment.