hrkrshnn

hrkrshnn

Member Since 6 years ago

@ethereum,

Experience Points
84
follower
Lessons Completed
0
follow
Lessons Completed
142
stars
Best Reply Awards
22
repos

660 contributions in the last year

Pinned
⚡ Solidity, the Smart Contract Programming Language
⚡ Program to compute the space P(n; 3, 3, 3, 3) and plot the elements in H^2
⚡ Solutions to A comprehensive introduction to differential geometry, Vol 1, by Micheal Spivak.
⚡ Solutions to "A Basic Course in Algebraic Topology" by Massey.
Activity
Jan
24
17 hours ago
push

hrkrshnn push ethereum/solidity

hrkrshnn
hrkrshnn

Fixed a ICE on calldata to struct member copy

commit sha: a82eef92acb662c4d79bd2bb7666541caec09839

push time in 4 hours ago
push

hrkrshnn push ethereum/solidity

hrkrshnn
hrkrshnn

Fixed a ICE on calldata to struct member copy

commit sha: c881e8f2b8607e56d7dbd9e9c56d49e186e4be75

push time in 5 hours ago
Activity icon
issue

hrkrshnn issue comment ethereum/solidity

hrkrshnn
hrkrshnn

Add description of events "imported" from libraries in a contract's ABI

Abstract

Contracts can emit events defined in libraries, either directly or using functions defined in these libraries. This works well, and the produced bytecode indeed emit the correct events, but the corresponding descriptions are not part of contracts's ABI

This results in potential difficulty to parse the events with tooling that relies on the ABI for event decoding.

Motivation

Lets consider the following code

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library MyLibrary {
    event SomeEvent();

    function someFunction() internal {
        emit SomeEvent();
    }
}

contract MyContract {
    function doSomething() external {
        MyLibrary.someFunction();
    }

    function doSomethingElse() external {
        emit MyLibrary.SomeEvent();
    }
}

The ABI produced by the compiler is

[
	{
		"inputs": [],
		"name": "doSomething",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"inputs": [],
		"name": "doSomethingElse",
		"outputs": [],
		"stateMutability": "nonpayable",
		"type": "function"
	}
]

I believe it would be better if it could include the description of SomeEvent

	{
		"anonymous": false,
		"inputs": [],
		"name": "SomeEvent",
		"type": "event"
	},

Specification

Whenever a contract emits an event or calls a function that can emit an event, then the event description should be added to the contract ABI. I'm not familiar with the compiler, but that might be done by adding "accessible event" metadata to functions/libraries and propagating that.

Backwards Compatibility

This doesn't affect the produced bytecode, only the metadata. It only adds new entries to the ABI array. It doesn't remove or modify existing entries. Thus I believe it is fully backward compatible.

hrkrshnn
hrkrshnn

This is a duplicate of https://github.com/ethereum/solidity/issues/9765, and is almost implemented in https://github.com/ethereum/solidity/pull/10996

The last I checked, this requires a breaking change in the NatSpec output. We can schedule this for 0.9.0.

push

hrkrshnn push ethereum/solidity

hrkrshnn
hrkrshnn

External test for ElementFi

hrkrshnn
hrkrshnn

Merge pull request #12574 from ethereum/elementfi-ext-test

External test for ElementFi

commit sha: 29dde715093da71bb1efc829ea7b0ef969267458

push time in 5 hours ago
Activity icon
delete

hrkrshnn in ethereum/solidity delete branch elementfi-ext-test

deleted time in 5 hours ago
pull request

hrkrshnn pull request ethereum/solidity

hrkrshnn
hrkrshnn

External test for ElementFi

Part of #5956.

This adds an external test for ElementFi.

  • The contracts are on 0.8.x but the compilation pulls in Balancer which is still on 0.7.x. Lots of patching needed due to that.
    • I actually have to explicitly run scripts/load-balancer-contracts.sh script to pull in Balancer.
  • Tests via IR fail due to https://github.com/nomiclabs/hardhat/issues/2115.
  • It needs allowUnlimitedContractSize. Otherwise one test via IR was failing due to too high deployment cost.
pull request

hrkrshnn merge to ethereum/solidity

hrkrshnn
hrkrshnn

External test for ElementFi

Part of #5956.

This adds an external test for ElementFi.

  • The contracts are on 0.8.x but the compilation pulls in Balancer which is still on 0.7.x. Lots of patching needed due to that.
    • I actually have to explicitly run scripts/load-balancer-contracts.sh script to pull in Balancer.
  • Tests via IR fail due to https://github.com/nomiclabs/hardhat/issues/2115.
  • It needs allowUnlimitedContractSize. Otherwise one test via IR was failing due to too high deployment cost.
push

hrkrshnn push ethereum/solidity

hrkrshnn
hrkrshnn

Fixed a ICE on calldata to struct member copy

commit sha: c3c5aac5fff8ad6eafbf62397f24b207c47e1f87

push time in 5 hours ago
push

hrkrshnn push ethereum/solidity

hrkrshnn
hrkrshnn

Fixed a ICE on calldata to struct member copy

commit sha: aa99de408b3d35855207c261a33d4faa05002484

push time in 6 hours ago
Activity icon
created branch

hrkrshnn in ethereum/solidity create branch fix-memory-copy-bug

createdAt 6 hours ago
push

hrkrshnn push ethereum/solidity

hrkrshnn
hrkrshnn
hrkrshnn
hrkrshnn

Merge pull request #12578 from gorgos/patch-1

Add msg.sig to cheatsheet

commit sha: 271b4e23a85076639c3aa8884417a1415f8f4d07

push time in 7 hours ago
open pull request

hrkrshnn wants to merge ethereum/solidity

hrkrshnn
hrkrshnn

Disallow comparison operators on contracts

fixes #11700 depends on #12566

hrkrshnn
hrkrshnn

Can you add a couple more operations? Perhaps also for C.

pull request

hrkrshnn merge to ethereum/solidity

hrkrshnn
hrkrshnn

Disallow comparison operators on contracts

fixes #11700 depends on #12566

Activity icon
issue

hrkrshnn issue comment ethereum/solidity

hrkrshnn
hrkrshnn

External test for ElementFi

Part of #5956.

This adds an external test for ElementFi.

  • The contracts are on 0.8.x but the compilation pulls in Balancer which is still on 0.7.x. Lots of patching needed due to that.
    • I actually have to explicitly run scripts/load-balancer-contracts.sh script to pull in Balancer.
  • Tests via IR fail due to https://github.com/nomiclabs/hardhat/issues/2115.
  • It needs allowUnlimitedContractSize. Otherwise one test via IR was failing due to too high deployment cost.
hrkrshnn
hrkrshnn

Looks good. Needs a rebase.

open pull request

hrkrshnn wants to merge ethereum/solidity

hrkrshnn
hrkrshnn

Add msg.sig to cheatsheet

hrkrshnn
hrkrshnn
- ``msg.sig`` (``bytes4``): first four bytes of the calldata (i.e. function identifier)
- ``msg.value`` (``uint``): number of wei sent with the message
open pull request

hrkrshnn wants to merge ethereum/solidity

hrkrshnn
hrkrshnn

Add msg.sig to cheatsheet

hrkrshnn
hrkrshnn

I'd leave it sorted, just like in units-and-global-variables.rst.

push

hrkrshnn push ethereum/solidity

hrkrshnn
hrkrshnn
hrkrshnn
hrkrshnn

Merge pull request #12542 from ethereum/prb-math-ext-test

External test for PRBMath

commit sha: 8f1abe4085f68224107308e6dc8c0eea8776bed3

push time in 7 hours ago
Activity icon
delete

hrkrshnn in ethereum/solidity delete branch prb-math-ext-test

deleted time in 7 hours ago
pull request

hrkrshnn pull request ethereum/solidity

hrkrshnn
hrkrshnn

External test for PRBMath

Part of #5956.

This adds an external test for PRBMath. We already have a copy of an older version of this contract in test/libsolidity/semanticTests/externalContracts/ but the external test will track upstream directly and will also be useful for benchmarking.

ir-optimize-evm+yul compiles but does not pass tests due to https://github.com/nomiclabs/hardhat/issues/2115.

This one was pretty easy and did not need any special workarounds.

pull request

hrkrshnn merge to ethereum/solidity

hrkrshnn
hrkrshnn

External test for PRBMath

Part of #5956.

This adds an external test for PRBMath. We already have a copy of an older version of this contract in test/libsolidity/semanticTests/externalContracts/ but the external test will track upstream directly and will also be useful for benchmarking.

ir-optimize-evm+yul compiles but does not pass tests due to https://github.com/nomiclabs/hardhat/issues/2115.

This one was pretty easy and did not need any special workarounds.

Previous