Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Dec 6, 2024
1 parent 682ee36 commit 54e919c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ github.com/ethereum/go-ethereum v1.14.6 h1:ZTxnErSopkDyxdvB8zW/KcK+/AVrdil/TzoWX
github.com/ethereum/go-ethereum v1.14.6/go.mod h1:hglUZo/5pVIYXNyYjWzsAUDpT/zI+WbWo/Nih7ot+G0=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
Expand Down
12 changes: 8 additions & 4 deletions go/enclave/storage/enclavedb/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func loadReceiptsAndEventLogs(ctx context.Context, db *sql.DB, requestingAccount

if requestingAccount != nil {
// Add log visibility rules
logsVisibQuery, logsVisibParams := logsVisibilityQuery(requestingAccount)
logsVisibQuery, logsVisibParams := logsVisibilityQuery(requestingAccount, withReceipts)
query += logsVisibQuery
queryParams = append(queryParams, logsVisibParams...)

Expand Down Expand Up @@ -461,15 +461,19 @@ func receiptsVisibilityQuery(requestingAccount *gethcommon.Address) (string, []a
}

// this function encodes the event log visibility rules
func logsVisibilityQuery(requestingAccount *gethcommon.Address) (string, []any) {
func logsVisibilityQuery(requestingAccount *gethcommon.Address, withReceipts bool) (string, []any) {
acc := requestingAccount.Bytes()

visibParams := make([]any, 0)

visibQuery := "AND ("

// this condition only affects queries that return receipts that have no events logs
visibQuery += " (e.id is NULL) "
if withReceipts {
// this condition only affects queries that return receipts that have no events logs
visibQuery += " (e.id is NULL) "
} else {
visibQuery += " (1=0) "
}

// everyone can query config_public events
visibQuery += " OR (et.config_public=true) "
Expand Down

0 comments on commit 54e919c

Please sign in to comment.