Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Sep 13, 2024
1 parent 4d76dc7 commit b06256f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
6 changes: 3 additions & 3 deletions go/enclave/evm/evm_facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func executeTransaction(
rules := cc.Rules(big.NewInt(0), true, 0)
from, err := types.Sender(types.LatestSigner(cc), t.Tx)
if err != nil {
return &core.TxExecResult{nil, nil, err}
return &core.TxExecResult{Err: err}
}
s.Prepare(rules, from, gethcommon.Address{}, t.Tx.To(), nil, nil)
snap := s.Snapshot()
Expand Down Expand Up @@ -238,15 +238,15 @@ func executeTransaction(
header.MixDigest = before
if err != nil {
s.RevertToSnapshot(snap)
return &core.TxExecResult{receipt, nil, err}
return &core.TxExecResult{Receipt: receipt, Err: err}
}

contractsWithVisibility := make(map[gethcommon.Address]*core.ContractVisibilityConfig)
for _, contractAddress := range createdContracts {
contractsWithVisibility[*contractAddress] = &core.ContractVisibilityConfig{AutoConfig: true}
}

return &core.TxExecResult{receipt, contractsWithVisibility, nil}
return &core.TxExecResult{Receipt: receipt, CreatedContracts: contractsWithVisibility}
}

func logReceipt(r *types.Receipt, logger gethlog.Logger) {
Expand Down
4 changes: 2 additions & 2 deletions go/enclave/storage/events_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@ func (es *eventsStorage) storeTopics(ctx context.Context, dbTX *sql.Tx, l *types
for i := 1; i < len(l.Topics); i++ {
topic := l.Topics[i]
// first check if there is an entry already for this topic
eventTopicId, relAddressId, err := es.findEventTopic(ctx, dbTX, topic.Bytes())
eventTopicId, _, err := es.findEventTopic(ctx, dbTX, topic.Bytes())
if err != nil && !errors.Is(err, errutil.ErrNotFound) {
return nil, fmt.Errorf("could not read the event topic. Cause: %w", err)
}
if errors.Is(err, errutil.ErrNotFound) {
// check whether the topic is an EOA
relAddressId, err = es.findRelevantAddress(ctx, dbTX, topic)
relAddressId, err := es.findRelevantAddress(ctx, dbTX, topic)
if err != nil && !errors.Is(err, errutil.ErrNotFound) {
return nil, fmt.Errorf("could not read relevant address. Cause %w", err)
}
Expand Down
15 changes: 11 additions & 4 deletions go/enclave/storage/init/edgelessdb/001_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ create table if not exists tendb.receipt

create table if not exists tendb.contract
(
id INTEGER AUTO_INCREMENT,
address binary(20) NOT NULL,
owner int NOT NULL,
id INTEGER AUTO_INCREMENT,
address binary(20) NOT NULL,
creator int NOT NULL,
auto_visibility boolean NOT NULL,
transparent boolean,
primary key (id),
INDEX USING HASH (address)
);
Expand All @@ -129,7 +131,12 @@ create table if not exists tendb.event_type
id INTEGER AUTO_INCREMENT,
contract int NOT NULL,
event_sig binary(32) NOT NULL,
public boolean NOT NULL,
auto_visibility boolean NOT NULL,
public boolean NOT NULL,
topic1_can_view boolean,
topic2_can_view boolean,
topic3_can_view boolean,
sender_can_view boolean,
primary key (id),
INDEX USING HASH (contract, event_sig)
);
Expand Down
2 changes: 1 addition & 1 deletion go/enclave/storage/init/sqlite/001_init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ create table if not exists contract
auto_visibility boolean NOT NULL,
transparent boolean
);
create index IDX_CONTRACT_AD on contract (address, creator);
create index IDX_CONTRACT_AD on contract (address);

create table if not exists externally_owned_account
(
Expand Down

0 comments on commit b06256f

Please sign in to comment.