From 85b06319bae0d8e0301da96a76b7e804d38605a8 Mon Sep 17 00:00:00 2001 From: Maksym Hrynenko Date: Fri, 6 Dec 2024 15:51:09 +0200 Subject: [PATCH] add: replicator address in config to hash during signing root --- config.yaml | 1 + internal/config/replicator.go | 1 + internal/service/api/handlers/get_signed_state.go | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index ba1be3e..4a0622d 100644 --- a/config.yaml +++ b/config.yaml @@ -31,6 +31,7 @@ pinger: max_abnormal_period: 10s replicator: + address: 0x10f370A6d8782E0e0E85ba948be6DA2465Aab4E2 source_smt: 0xc1534912902BBe8C54626e2D69288C76a843bc0E root_prefix: Rarimo root diff --git a/internal/config/replicator.go b/internal/config/replicator.go index 8cb13aa..bc021a0 100644 --- a/internal/config/replicator.go +++ b/internal/config/replicator.go @@ -13,6 +13,7 @@ const ( ) type Replicator struct { + Address common.Address `fig:"address,required"` SourceSMT common.Address `fig:"source_smt,required"` RootPrefix string `fig:"root_prefix,required"` } diff --git a/internal/service/api/handlers/get_signed_state.go b/internal/service/api/handlers/get_signed_state.go index 9daa11d..1b6df9d 100644 --- a/internal/service/api/handlers/get_signed_state.go +++ b/internal/service/api/handlers/get_signed_state.go @@ -6,7 +6,6 @@ import ( "net/http" "github.com/ethereum/go-ethereum/crypto" - "github.com/rarimo/proof-verification-relayer/internal/config" "github.com/rarimo/proof-verification-relayer/internal/data" "github.com/rarimo/proof-verification-relayer/internal/service/api/requests" "github.com/rarimo/proof-verification-relayer/resources" @@ -80,7 +79,7 @@ func signState(state data.State, r *http.Request) ([]byte, error) { digest := crypto.Keccak256( []byte(Config(r).Replicator().RootPrefix), Config(r).Replicator().SourceSMT.Bytes(), - Config(r).ContractsConfig()[config.SMTReplicator].Address.Bytes(), + Config(r).Replicator().Address.Bytes(), rootBytes, new(big.Int).SetUint64(state.Timestamp).Bytes(), )