Skip to content

Commit

Permalink
clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Oct 1, 2024
1 parent 6d1e24a commit 824d6ea
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions go/enclave/evm/evm_facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,29 +279,44 @@ func readVisibilityConfig(vmenv *vm.EVM, contractAddress *gethcommon.Address) *c
EventConfigs: make(map[gethcommon.Hash]*core.EventVisibilityConfig),
}

if transp {
return cfg
}

// only check the config for non-transparent contracts
for i := range visibilityRules.EventLogConfigs {
logConfig := visibilityRules.EventLogConfigs[i]
relevantToMap := make(map[uint8]bool)
for _, field := range logConfig.VisibleTo {
relevantToMap[field] = true
}
t1 := relevantToMap[topic1]
t2 := relevantToMap[topic2]
t3 := relevantToMap[topic3]
s := relevantToMap[sender]
cfg.EventConfigs[logConfig.EventSignature] = &core.EventVisibilityConfig{
AutoConfig: false,
Public: relevantToMap[everyone],
Topic1CanView: &t1,
Topic2CanView: &t2,
Topic3CanView: &t3,
SenderCanView: &s,
}
cfg.EventConfigs[logConfig.EventSignature] = eventCfg(logConfig)
}

return cfg
}

func eventCfg(logConfig ContractTransparencyConfigEventLogConfig) *core.EventVisibilityConfig {
relevantToMap := make(map[uint8]bool)
for _, field := range logConfig.VisibleTo {
relevantToMap[field] = true
}
isPublic := relevantToMap[everyone]

if isPublic {
return &core.EventVisibilityConfig{AutoConfig: false, Public: true}
}

t1 := relevantToMap[topic1]
t2 := relevantToMap[topic2]
t3 := relevantToMap[topic3]
s := relevantToMap[sender]
return &core.EventVisibilityConfig{
AutoConfig: false,
Public: false,
Topic1CanView: &t1,
Topic2CanView: &t2,
Topic3CanView: &t3,
SenderCanView: &s,
}
}

func logReceipt(r *types.Receipt, logger gethlog.Logger) {
if logger.Enabled(context.Background(), gethlog.LevelTrace) {
logger.Trace("Receipt", log.TxKey, r.TxHash, "Result", receiptToString(r))
Expand Down

0 comments on commit 824d6ea

Please sign in to comment.