Skip to content

Commit

Permalink
fix address compare (#2175)
Browse files Browse the repository at this point in the history
* fix address compare

* fix the receipt log filtering
  • Loading branch information
tudor-malene authored Dec 3, 2024
1 parent 52c5c17 commit 74a6256
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions go/enclave/rpc/GetTransactionReceipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func fetchFromCache(ctx context.Context, storage storage.Storage, cacheService *
// receipt found in cache
// for simplicity only the tx sender will access the cache
// check whether the requester is the sender
if rec.From != requester {
if *rec.From != *requester {
return nil, nil
}

Expand Down Expand Up @@ -145,8 +145,8 @@ func isAddress(topics []gethcommon.Hash, nr int, requester *gethcommon.Address)
if len(topics) < nr+1 {
return false
}
topic := gethcommon.Address(topics[nr].Bytes())
return topic == *requester
addressFromTopic := gethcommon.BytesToAddress(topics[nr].Bytes())
return addressFromTopic == *requester
}

// marshalReceipt marshals a transaction receipt into a JSON object.
Expand Down
4 changes: 2 additions & 2 deletions go/host/enclave/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (e *Service) EvictEnclave(enclaveID *common.EnclaveID) {
e.haLock.Lock()
defer e.haLock.Unlock()
for i, guardian := range e.enclaveGuardians {
if guardian.GetEnclaveID() == enclaveID {
if *(guardian.GetEnclaveID()) == *enclaveID {
failedEnclaveIdx = i
break
}
Expand All @@ -141,7 +141,7 @@ func (e *Service) EvictEnclave(enclaveID *common.EnclaveID) {
e.enclaveGuardians = append(e.enclaveGuardians[:failedEnclaveIdx], e.enclaveGuardians[failedEnclaveIdx+1:]...)
e.logger.Warn("Evicted enclave from HA pool.", log.EnclaveIDKey, enclaveID)

if e.activeSequencerID == enclaveID {
if *e.activeSequencerID == *enclaveID {
// sequencer enclave has failed, so we need to select another one to promote as the active sequencer
var i int
for i = 0; i < len(e.enclaveGuardians); i++ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestMultiEnclaveSequencer(t *testing.T) {
// This test runs with an HA sequencer, does a transfer then kills the active sequencer enclave,
// allows it time to failover then performs another transfer to check the failover was successful.
// Note: this is a happy path failover, we need to test for edge cases etc and test the failover in a live testnet
func TestHASequencerFailover(t *testing.T) {
func TestHASequencerBackup(t *testing.T) {
networktest.TestOnlyRunsInIDE(t)
doubleTransferAmount := big.NewInt(2).Mul(big.NewInt(2), _transferAmount)
networktest.Run(
Expand Down

0 comments on commit 74a6256

Please sign in to comment.