-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call 'visibilityRules' method #2058
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: Apache 2 | ||
pragma solidity ^0.8.20; | ||
|
||
// implement this interface if you want to configure the visibility rules of your smart contract | ||
// the TEN platform will interpret this information | ||
interface ContractTransparencyConfig { | ||
// configuration per event log type | ||
struct EventLogConfig { | ||
bytes eventSignature; | ||
bool isPublic; // everyone can see and query for this event | ||
bool topic1CanView; // If the event is private, and this is true, it means that the address from topic1 is an EOA that can view this event | ||
bool topic2CanView; // same | ||
bool topic3CanView; // same | ||
bool visibleToSender; // if true, the tx signer will see this event. Default false | ||
} | ||
|
||
struct VisibilityConfig { | ||
bool isTransparent; // If true - the internal state via getStorageAt will be accessible to everyone. All events will be public. Default false | ||
EventLogConfig[] eventLogConfigs; // mapping from event signature to visibility configs per event | ||
} | ||
|
||
// keep the logic independent of the environment | ||
// max gas: 1 Million | ||
function visibilityRules() external pure returns (VisibilityConfig memory); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package evm | ||
|
||
import ( | ||
"errors" | ||
"math/big" | ||
"strings" | ||
|
||
ethereum "github.com/ethereum/go-ethereum" | ||
"github.com/ethereum/go-ethereum/accounts/abi" | ||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/event" | ||
) | ||
|
||
// file generated by ethereum tooling to help calling the "visibilityRules" function | ||
|
||
// Reference imports to suppress errors if they are not otherwise used. | ||
var ( | ||
_ = errors.New | ||
_ = big.NewInt | ||
_ = strings.NewReader | ||
_ = ethereum.NotFound | ||
_ = bind.Bind | ||
_ = common.Big1 | ||
_ = types.BloomLookup | ||
_ = event.NewSubscription | ||
_ = abi.ConvertType | ||
) | ||
|
||
// ContractTranspMetaData contains all meta data concerning the TransparencyConfig contract. | ||
var ContractTranspMetaData = &bind.MetaData{ | ||
ABI: "[{\"inputs\":[],\"name\":\"visibilityRules\",\"outputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"isTransparent\",\"type\":\"bool\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"eventSignature\",\"type\":\"bytes\"},{\"internalType\":\"bool\",\"name\":\"isPublic\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"topic1CanView\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"topic2CanView\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"topic3CanView\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"visibleToSender\",\"type\":\"bool\"}],\"internalType\":\"structContractTransparencyConfig.EventLogConfig[]\",\"name\":\"eventLogConfigs\",\"type\":\"tuple[]\"}],\"internalType\":\"structContractTransparencyConfig.VisibilityConfig\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", | ||
} | ||
|
||
// ContractTransparencyConfigEventLogConfig is an auto generated low-level Go binding around an user-defined struct. | ||
type ContractTransparencyConfigEventLogConfig struct { | ||
EventSignature []byte | ||
IsPublic bool | ||
Topic1CanView bool | ||
Topic2CanView bool | ||
Topic3CanView bool | ||
VisibleToSender bool | ||
} | ||
|
||
// ContractTransparencyConfigVisibilityConfig is an auto generated low-level Go binding around an user-defined struct. | ||
type ContractTransparencyConfigVisibilityConfig struct { | ||
IsTransparent bool | ||
EventLogConfigs []ContractTransparencyConfigEventLogConfig | ||
} | ||
|
||
// TransparencyConfig is an auto generated Go binding around an Ethereum contract. | ||
type TransparencyConfig struct { | ||
TransparencyConfigCaller // Read-only binding to the contract | ||
} | ||
|
||
// TransparencyConfigCaller is an auto generated read-only Go binding around an Ethereum contract. | ||
type TransparencyConfigCaller struct { | ||
contract *bind.BoundContract // Generic contract wrapper for the low level calls | ||
} | ||
|
||
// NewTransparencyConfigCaller creates a new read-only instance of TransparencyConfig, bound to a specific deployed contract. | ||
func NewTransparencyConfigCaller(address common.Address, caller bind.ContractCaller) (*TransparencyConfigCaller, error) { | ||
contract, err := bindContractTransp(address, caller, nil, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &TransparencyConfigCaller{contract: contract}, nil | ||
} | ||
|
||
// bindContractTransp binds a generic wrapper to an already deployed contract. | ||
func bindContractTransp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { | ||
parsed, err := ContractTranspMetaData.GetAbi() | ||
if err != nil { | ||
return nil, err | ||
} | ||
return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil | ||
} | ||
|
||
// VisibilityRules is a free data retrieval call binding the contract method 0x30173dd1. | ||
// | ||
// Solidity: function visibilityRules() pure returns((bool,(bytes,bool,bool,bool,bool,bool)[])) | ||
func (_ContractTransp *TransparencyConfigCaller) VisibilityRules(opts *bind.CallOpts) (ContractTransparencyConfigVisibilityConfig, error) { | ||
var out []interface{} | ||
err := _ContractTransp.contract.Call(opts, &out, "visibilityRules") | ||
if err != nil { | ||
return *new(ContractTransparencyConfigVisibilityConfig), err | ||
} | ||
|
||
out0 := *abi.ConvertType(out[0], new(ContractTransparencyConfigVisibilityConfig)).(*ContractTransparencyConfigVisibilityConfig) | ||
|
||
return out0, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure why this
applyTx
nested function exists, makes this quite hard to follow. But seems like vmenv will always be created or we'd have returned with error before you use it outside the function so guess it works.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh, I don't remember either. I think @StefanIliev545 might have worked in this area as well.
At some point we were depending on geth internal functions, which eventually became public