You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All generic types (block number, time stamp...) that are loaded into/from contract memory should be the Ethereum native type instead of being configurable.
#5574
They should use whatever type they are in EVM and the runtime is responsible for conversion and erroring out on overflow.
This also includes topics which are right now read as a SCALE encoded Vec. We don't want to rely on SCALE here. Instead, they should just be packed next to each other in memory. We merely pass the number of topics to the host function.
The text was updated successfully, but these errors were encountered:
athei
changed the title
All generic types (block number, time stamp...) that are loaded into/from contract memory should be u256 **little** endian instead of being configurable.
All generic types (block number, time stamp...) that are loaded into/from contract memory should be the Ethereum native type instead of being configurable.
Sep 3, 2024
fix#5574
- Use U256 instead of BalanceOf<T> and MomentOf<T> in Ext trait
- Enforce H256 for T::Hash
The Ext trait still depends on the associated type `T: Config`, we can
look into refactoring it even more later but even in the current state
it should not influence how the data is encoded / decoded between the
contract and the host
```
fn caller(&self) -> Origin<Self::T>;
-> only use to extract the address of the caller
fn account_id(&self) -> &AccountIdOf<Self::T>;
-> only used to expose the address or access the account_id internally
fn gas_meter(&self) -> &GasMeter<Self::T>;
fn gas_meter_mut(&mut self) -> &mut GasMeter<Self::T>;
-> encoding does not depend on T
fn call_runtime(&self, call: <Self::T as Config>::RuntimeCall) -> DispatchResultWithPostInfo;
-> Substrate specific, just an opaque blob of bytes from the contract's perspective
fn contract_info(&mut self) -> &mut ContractInfo<Self::T>;
fn transient_storage(&mut self) -> &mut TransientStorage<Self::T>;
-> gated by #[cfg(any(test, feature = "runtime-benchmarks"))]
```
fix#5574
- Use U256 instead of BalanceOf<T> and MomentOf<T> in Ext trait
- Enforce H256 for T::Hash
The Ext trait still depends on the associated type `T: Config`, we can
look into refactoring it even more later but even in the current state
it should not influence how the data is encoded / decoded between the
contract and the host
```
fn caller(&self) -> Origin<Self::T>;
-> only use to extract the address of the caller
fn account_id(&self) -> &AccountIdOf<Self::T>;
-> only used to expose the address or access the account_id internally
fn gas_meter(&self) -> &GasMeter<Self::T>;
fn gas_meter_mut(&mut self) -> &mut GasMeter<Self::T>;
-> encoding does not depend on T
fn call_runtime(&self, call: <Self::T as Config>::RuntimeCall) -> DispatchResultWithPostInfo;
-> Substrate specific, just an opaque blob of bytes from the contract's perspective
fn contract_info(&mut self) -> &mut ContractInfo<Self::T>;
fn transient_storage(&mut self) -> &mut TransientStorage<Self::T>;
-> gated by #[cfg(any(test, feature = "runtime-benchmarks"))]
```
---------
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
They should use whatever type they are in EVM and the runtime is responsible for conversion and erroring out on overflow.
This also includes topics which are right now read as a SCALE encoded Vec. We don't want to rely on SCALE here. Instead, they should just be packed next to each other in memory. We merely pass the number of topics to the host function.
The text was updated successfully, but these errors were encountered: